/**
 * 截取两个字段之间的内容
 * @param {string} source 源字符串
 * @param {string} startStr 起始字段
 * @param {string} endStr 结束字段
 * @returns {string} 截取结果
 */
function getMiddleString(source, startStr, endStr) {
  if (typeof source !== 'string' || !startStr || !endStr) return '';
  
  const startIndex = source.indexOf(startStr);
  if (startIndex === -1) return '';
  
  const endIndex = source.indexOf(endStr, startIndex + startStr.length);
  if (endIndex === -1) return '';
  
  return source.substring(
    startIndex + startStr.length,
    endIndex
  ).trim();
}

module.exports = {
  getMiddleString
}